package com.cqw.redistest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/redis")
public class RedisTestController {

    @Autowired
    private RedisManager redisManager;

    @GetMapping("/test")
    public String test() {
        Object name = redisManager.get("name");
        System.out.println(name);
        return "OK";
    }

    @GetMapping("/test1")
    public String test1() {
        long name = redisManager.incr("name", 0);
        System.out.println(name);
        return "OK";
    }

    @GetMapping("/test2/{num}")
    public String test2(@PathVariable int num) {
        long name = redisManager.incr("name", num);
        System.out.println(name);
        return "OK";
    }


}
